<?php
/**
 * Created by PhpStorm.
 * User: lottery
 * Date: 2016/10/26
 * Time: 18:28
 */

namespace Usap\Model\Admin;


use Usap\Model\BaseModel;

class LocationInfoModel extends BaseModel
{

    //数据源配置
    public function _initialize()
    {
        $this->connection = C('db_pool.admin');
        $this->trueTableName = 'location_info';
    }

    public function getCityByPartId($part_id, $fields = 'location_id, city_name')
    {
        $condition = array(
            'location_id' => array('like', $part_id.'%'),
            'district_name' => array('exp', 'is null'),
            'city_name' => array('exp', 'is not null')
        );
        $res_info = $this->where($condition)->field($fields)->select();

        return $res_info;
    }

}